home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Mac OS USB DDK_v1.0.1 / Examples / PrinterClassDriver / ChooserPACK.r < prev    next >
Encoding:
Text File  |  1998-09-03  |  9.3 KB  |  336 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ChooserPACK.r
  3.  
  4.     Contains:    Rsrc description to build the PACK header and other rsrcs
  5.                 needed by the PACK code
  6.  
  7. */
  8.  
  9. /***********************************************************************************/
  10. /****  Includes                                                                    ****/
  11. /***********************************************************************************/
  12. #ifndef __CHOOSERPACK__
  13. #define __CHOOSERPACK__
  14.  
  15. #ifndef __COMMON__
  16. #include "Common.h"
  17. #endif
  18.  
  19. #ifndef __SYSTYPES_R__
  20. #include "Types.r"                /* To get system types */
  21. #endif
  22.  
  23. #ifndef __SYSTYPES_R__
  24. #include "SysTypes.r"
  25. #endif
  26.  
  27. /***********************************************************************************/
  28. /****  PACK                                                                        ****/
  29. /***********************************************************************************/
  30. /*
  31.  * When building a PACK resource, insert the line:
  32.  *
  33.  *        type 'PACK' as 'PACW';
  34.  *
  35.  * in your resource file before your "resource 'PACK' ..." declaration.
  36.  */
  37.  
  38. type 'PACW' {
  39.     unsigned integer    = $600e;        /* bra.s to offset $e        */
  40.     unsigned integer    = 0;            /* device ID (Usually 0)    */
  41.     literal longint        = 'PACK';        /* res type, always PACK    */
  42.     integer                = kPACKID;        /* res ID always -4096        */
  43.     integer;                            /* version of driver        */
  44.  
  45.     /*
  46.     Values for flags obtained from Chooser source code file RDEVEqu.a and
  47.     IM Devices, pp 1-46…
  48.     */
  49.     boolean notAppleTalkDev,        appleTalkDev;        /* 31:Appletalk device?        */
  50.     boolean notPAPDev,                papDev;                /* 30:Printer Access Protocol device? */
  51.     boolean notPostScriptDev,        postScriptDev;        /* 29:PostScript device?        */
  52.     boolean noMultiples,            multiples;            /* 28:multiple selections?        */
  53.     boolean noLeftButton,            leftButton;            /* 27:uses left button            */
  54.     boolean noRightButton,            rightButton;        /* 26:uses right button        */
  55.     boolean saveZone,                dontSaveZone;        /* 25:saved zone name            */
  56.     boolean doesntUseZones,            usesZones;            /* 24:uses zone names name        */
  57.     boolean intlChars,                noIntlChars;        /* 23:Translate int'l chars to U.S.? */
  58.     boolean noEvenName,                evenName;            /* 22:Is this a LaserWriter? */
  59.     boolean noLengthOnRename,        lengthOnRename;        /* 21:Pass length byte in Rename name? */
  60.     boolean noOnOff,                onOff;                /* 20:Device uses on/off radio buttons. */
  61.     boolean selfSend,                dontSelfSend;        /* 19:Receive info from this machine? */
  62.     boolean = 0;                                        /* 18:reserved                    */
  63.     boolean doesntAcceptInit,        acceptsInit;        /* 17:accepts Initialize msg    */
  64.     boolean doesntAcceptNewSel,        acceptsNewSel;        /* 16:accepts newSel msg        */
  65.     boolean doesntAcceptFillList,    acceptsFillList;    /* 15:accepts FillList msg        */
  66.     boolean doesntAcceptGetSel,        acceptsGetSel;        /* 14:accepts GetSel msg        */
  67.     boolean doesntAcceptSelect,        acceptsSelect;        /* 13:accepts Select msg        */
  68.     boolean doesntAcceptDeselect,    acceptsDeselect;    /* 12:accepts Deselect msg        */
  69.     boolean doesntAcceptTerm,        acceptsTerm;        /* 11:accepts Terminate msg        */
  70.     boolean doesntAcceptRename,        acceptsRename;        /* 10:accepts Rename msg        */
  71.     boolean = 0;                                        /*  9:reserved                    */
  72.     boolean = 0;                                        /*  8:reserved                    */
  73.     boolean = 0;                                        /*  7:reserved                    */
  74.     boolean = 0;                                        /*  6:reserved                    */
  75.     boolean = 0;                                        /*  5:reserved                    */
  76.     boolean = 0;                                        /*  4:reserved                    */
  77.     boolean = 0;                                        /*  3:reserved                    */
  78.     boolean = 0;                                        /*  2:reserved                    */
  79.     boolean = 0;                                        /*  1:reserved                    */
  80.     boolean packExists,                noPackage;            /*  0:Is the Package really there? */
  81.  
  82.     /*
  83.     The PACK code is inserted here by Rez. Use the $$Resource() directive…
  84.     */
  85.     hex string;
  86. };
  87.  
  88. type 'CTYP' {
  89.     unsigned integer    = 0;        /* type of connection for selected printer 0-none 1-serial 2-UBB */
  90.     unsigned integer doesntSupportSerial,        supportsSerial;
  91.     unsigned integer doesntSupportUSB,            supportsUSB;
  92. };
  93.  
  94. /*
  95. *    What connection types we support and the type of connection for the selected printer
  96. */
  97. resource 'CTYP'(1000, purgeable ) {
  98.     supportsSerial,
  99.     supportsUSB
  100. };
  101.  
  102. /*
  103. *    Path in name registry for the printer models this driver supports
  104. */
  105. resource 'STR#'(1000, purgeable ) {
  106.     {
  107.     "Devices:device-tree:PRINTER:Color StyleWriter 6500",
  108.     "Devices:device-tree:PRINTER:DeskJet 870C",
  109.     }
  110. };
  111.  
  112. /*
  113. *    Path in name registry for the last selected usb printer
  114. *    The code should not change the size of the rsrcs. 
  115. *    Therefore this rsrc must be kepted at a fixed length 
  116. *    size of 256 bytes!
  117. */
  118.  
  119. data 'STR ' (2000, purgeable) {
  120.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  121.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  122.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  123.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  124.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  125.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  126.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  127.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  128.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  129.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  130.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  131.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  132.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  133.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  134.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  135.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  136. };
  137.  
  138. /*
  139. *    Name of last selected usb printer
  140. *    The code should not change the size of the rsrcs. 
  141. *    Therefore this rsrc must be kepted at a fixed length 
  142. *    size of 256 bytes!
  143. */
  144.  
  145. data 'STR ' (2100, purgeable) {
  146.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  147.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  148.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  149.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  150.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  151.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  152.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  153.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  154.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  155.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  156.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  157.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  158.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  159.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  160.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  161.     $"0000 0000 0000 0000 0000 0000 0000 0000"
  162. };
  163.  
  164. /*
  165. *    Color table for no Name Registry alert dialog
  166. */
  167. resource 'actb' (3000) {
  168.     {    /* array ColorSpec: 5 elements */
  169.         /* [1] */
  170.         wContentColor, 65535, 65535, 65535,
  171.         /* [2] */
  172.         wFrameColor, 0, 0, 0,
  173.         /* [3] */
  174.         wTextColor, 0, 0, 0,
  175.         /* [4] */
  176.         wHiliteColor, 0, 0, 0,
  177.         /* [5] */
  178.         wTitleBarColor, 65535, 65535, 65535
  179.     }
  180. };
  181.  
  182. /*
  183. *    Alert used when Name Registry isnt present
  184. */
  185. resource 'ALRT' (3000) {
  186.     {50, 30, 180, 430},
  187.     3000,
  188.     {    /* array: 4 elements */
  189.         /* [1] */
  190.         OK, visible, sound1,
  191.         /* [2] */
  192.         OK, visible, sound1,
  193.         /* [3] */
  194.         OK, visible, sound1,
  195.         /* [4] */
  196.         OK, visible, sound1
  197.     }
  198.     ,alertPositionMainScreen
  199. };
  200.  
  201. /*
  202. *    DITL for alert
  203. */
  204. resource 'DITL' (3000) {
  205.     {    /* array DITLarray: 2 elements */
  206.         /* [1] */
  207.         {97, 313, 117, 387},
  208.         Button {
  209.             enabled,
  210.             "OK"
  211.         },
  212.         /* [2] */
  213.         {13, 74, 84, 387},
  214.         StaticText {
  215.             disabled,
  216.             "The Name Registry is missing from this c"
  217.             "omputer. It is required by this driver t"
  218.             "o function properly."
  219.         }
  220.     }
  221. };
  222.  
  223. /*
  224. *    Color table for printer not available alert dialog
  225. */
  226. resource 'actb' (3100) {
  227.     {    /* array ColorSpec: 5 elements */
  228.         /* [1] */
  229.         wContentColor, 65535, 65535, 65535,
  230.         /* [2] */
  231.         wFrameColor, 0, 0, 0,
  232.         /* [3] */
  233.         wTextColor, 0, 0, 0,
  234.         /* [4] */
  235.         wHiliteColor, 0, 0, 0,
  236.         /* [5] */
  237.         wTitleBarColor, 65535, 65535, 65535
  238.     }
  239. };
  240.  
  241. /*
  242. *    Alert used when Name Registry isnt present
  243. */
  244. resource 'ALRT' (3100) {
  245.     {50, 30, 180, 430},
  246.     3100,
  247.     {    /* array: 4 elements */
  248.         /* [1] */
  249.         OK, visible, sound1,
  250.         /* [2] */
  251.         OK, visible, sound1,
  252.         /* [3] */
  253.         OK, visible, sound1,
  254.         /* [4] */
  255.         OK, visible, sound1
  256.     }
  257.     ,alertPositionMainScreen
  258. };
  259.  
  260. /*
  261. *    DITL for alert
  262. */
  263. resource 'DITL' (3100) {
  264.     {    /* array DITLarray: 2 elements */
  265.         /* [1] */
  266.         {97, 313, 117, 387},
  267.         Button {
  268.             enabled,
  269.             "OK"
  270.         },
  271.         /* [2] */
  272.         {13, 74, 84, 387},
  273.         StaticText {
  274.             disabled,
  275.             "The previously selected printer cannot b"
  276.             "e found. Please make sure the printer is"
  277.             " on, check the connections or make anoth"
  278.             "er selection."
  279.         }
  280.     }
  281. };
  282.  
  283.  
  284. /*
  285.  * This will produce a PACK resource from the special PACW type.
  286.  * (this eliminates the need for using the Assembler to create
  287.  *    the DA header, but makes it impossible to use SADE, oops!)
  288.  *
  289.  */
  290.  
  291. type 'PACK' as 'PACW';            /* Map 'PACW' => 'PACK' */
  292.  
  293. resource 'PACK' (kPACKID, purgeable) {
  294.     /*
  295.      * device version
  296.      */
  297.     3,
  298.     
  299.     /*
  300.      * PACK flags
  301.      */
  302.     notAppleTalkDev,        /* non appletalk device            */
  303.     notPAPDev,                /* non PAP device                */
  304.     notPostScriptDev,        /* non PostScript device        */
  305.     noMultiples,            /* multiple instances            */
  306.     noLeftButton,            /* use left button                */
  307.     noRightButton,            /* use right button                */
  308.     dontSaveZone,            /* save zone name                */
  309.     doesntUseZones,            /* uses zone names name            */
  310.     intlChars,                /* let international chars through */
  311.     noEvenName,                /* not a LaserWriter; leave the name alone */
  312.     noLengthOnRename,        /* don't send the length byte with the name */
  313.     noOnOff,                /* doesn't use on/off button    */
  314.     selfSend,                /* not really relevant            */
  315.     acceptsInit,            /* Accepts the Initialize msg    */
  316.     doesntAcceptNewSel,        /* no newSel msg                */
  317.     acceptsFillList,        /* FillList msg                    */
  318.     acceptsGetSel,            /* accepts GetSel msg            */
  319.     acceptsSelect,            /* accepts Select msg            */
  320.     acceptsDeselect,        /* Deselect msg                    */
  321.     acceptsTerm,            /* accept Terminate msg            */
  322.     doesntAcceptRename,        /* doesn't accept rename msg    */
  323.     packExists,                /* package really exists        */
  324.  
  325.     /*
  326.      * This directive inserts the contents of the PACW resource
  327.      * with our PACK code
  328.      */
  329.     #ifdef __MPW__
  330.         $$Resource("::ChsrPACW.rsrc", 'PACW', 0)
  331.     #else
  332.         $$Resource("ChsrPACW.rsrc", 'PACW', 0)
  333.     #endif
  334. };
  335.  
  336. #endif